<%@page import="com.sinodata.bsm.center.cache.PropertyValueCache"%>
<%@page import="com.sinodata.bsm.center.bean.ResBean"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.sinodata.bsm.center.util.spring.SpringContextHolder"%>
<%@page import="com.sinodata.bsm.center.service.resource.ResService"%>
<%@page import="com.sinodata.bsm.center.service.config.PortalService"%>
<%@ page import="com.sinodata.bsm.common.vo.*"%>
<%@ page import="com.sinodata.bsm.common.utils.*"%>
<%@ page import="com.sinodata.bsm.center.bean.*"%>
<%
ResService service = SpringContextHolder.getBean(ResService.class);
String resid = request.getParameter("resid");
Res  res = service.get(Long.parseLong(resid));
String pageno = request.getParameter("pageno");
Map<Long, String[]> useabalityMap=(Map)request.getAttribute("useabalityMap");
Map<Long,List<Property>> resPropertyMap=(Map)request.getAttribute("resPropertyMap");
if(pageno==null)pageno="1";
	List<Res> resList = (List)request.getAttribute("resList");
	Map<Long,String> fusionMap = new HashMap<Long,String>();
	for(int i = 0;i<resList.size();i++){
	    Res res1 = resList.get(i);
	    int deleted=res1.getDeleted();
	   	String chengglStr = "<chart lowerLimit='0' upperLimit='100' lowerLimitDisplay='Low' upperLimitDisplay='High' palette='1' chartLeftMargin='2' chartRightMargin='2' chartTopMargin='2' chartBottomMargin='2' manageResize='1' palette='5' lowerLimit='0' showBorder='0' showValue='0' showTickMarks='0' showTickValues='0'>";
	  		chengglStr += "<colorRange>";
	  		chengglStr += "<color minValue='0' maxValue='"+deleted+"' code='2cb900' />";
	  		//20% 验证 80%轻微
	  		if(deleted>0&& deleted<=20){
	  			//验证
	  			chengglStr += "<color minValue='"+deleted+"' maxValue='"+(100-deleted)+"' code='e1221a' />";
	  		}
	  		if(deleted>20&& deleted<=40){
	  			chengglStr += "<color minValue='"+deleted+"' maxValue='"+(100-deleted)+"' code='ff9937' />";
	  		}
	  		if(deleted>40 && deleted<=60){
	  			chengglStr += "<color minValue='"+deleted+"' maxValue='"+(100-deleted)+"' code='dede03' />";
	  		}
	  		if(deleted>60 && deleted<=80){
	  			chengglStr += "<color minValue='"+deleted+"' maxValue='"+(100-deleted)+"' code='56a8f4' />";
	  		}
	  		if(deleted>80 && deleted<=100){
	  			chengglStr += "<color minValue='"+deleted+"' maxValue='"+(100-deleted)+"' code='2cb900' />";
	  		}
	  		chengglStr += "</colorRange>";
	    	chengglStr += "<value>"+deleted+"</value>";
	    	chengglStr += "<value>"+100+"</value>";
	  		chengglStr += "</chart>";
	  		fusionMap.put(res1.getId(),chengglStr);
	}
%>

<script type="text/javascript">

  function initChart(){
      <%for(int i = 0;i<resList.size();i++){
		    Res r = resList.get(i);
		%>
			var LEDchengglChart = new FusionCharts("${pageContext.request.contextPath}/resources/charts/HLED.swf","LEDChartId<%=r.getId()%>", 185, 20, "0", "1");
			LEDchengglChart.setDataXML("<%=fusionMap.get(r.getId())%>");
			LEDchengglChart.render("LEDchenggl_<%=r.getId()%>");
		<%}%>
  }
</script>
<!--手机银行系统监控一览-->
<style type="text/css">
 body{
 padding:0px;
 }
 .max{
 width:100%;
 }
</style>
<!--监控一览-->
<div class="column">
	<b class="b1"></b>
	<b class="b2"></b>
	<b class="b3"></b>
	<b class="b4"></b>
	<div class="content" style="border-bottom:0px;">
		<h2><%=res.getName() %>业务状态</h2>
		<div style="overflow:hidden;height: 150px" id="useability_div1">
				<div style="width: 100%;overflow:hidden;height: auto;" id="useability_div2">
					<ul>
						<%for(Res r:resList){  
							  String[] useabality=useabalityMap.get(r.getId());
							  List<Property> propertyList=resPropertyMap.get(r.getId());
							  if(useabality!=null){
						%>
						<li>
							<h3>
								<a
									href="${pageContext.request.contextPath}/resource/res-query!view.action?id=<%=r.getId() %>&pId=0&viewId=1&ntype=2"
									style="cursor: pointer; color: #091782;" target="_blank"><%=r.getName() %></a>
							</h3>
							<div class="li_content2">
							    <div class="li_content2_top" id="LEDchenggl_<%=r.getId()%>"></div>
								<div class="li_content2_bottom">									
										  <div class="li_content2_bottom_left">
										    <a title="采集时间" class="time_a" href="#"><%=useabality[0] %></a>
										    <a title="产生事件数" class="event_a" href="#"><%=useabality[1] %></a>
										  </div>
										  <div class="li_content2_bottom_right">
										  <% 
										     for(int i=0;i<propertyList.size();i++){
										    	Property property=propertyList.get(i);
										      if(i>=3)
										    		break;
										  %>
										   <a href="#"><%=property.getName() %>:0</a>
										   <%
										     }
										   %>
										  </div>
										  <a class="more_a" href="${pageContext.request.contextPath}/appview/test.jsp" id="infor" rel="${pageContext.request.contextPath}/jsp/appview/test.jsp" title="<%=r.getName() %>指标详细信息">详情</a>								
								</div>								
							</div>
						</li>
						<%
						 } 
						 }%>
					</ul>
                    	<br class="clear" />
				</div>				
	        </div>
			    <div class="cate_more" id="cate_more">
				   <div class="toggle_arrow" id="toggle_down">
				     <i class="arrow"></i>
				   </div>
				   <div class="toggle_arrow" id="toggle_up" style="display: none">
				     <i class="arrow2"></i>
				  </div>
				</div>
		  </div>
			
</div>
<!--@end 手机银行系统监控一览-->
<script type="text/javascript">
</script>